package org.hackystat.devcathlon.ui.page.matches.manage;

import org.apache.wicket.behavior.SimpleAttributeModifier;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.hackystat.devcathlon.ui.DevcathlonSession;
import org.hackystat.devcathlon.ui.page.DevcathlonBasePage;
import org.hackystat.devcathlon.ui.page.matches.manage.matchpanel.MatchPanel;

/**
 * A "Manage" submenu allows the user to create, delete, or edit match info.
 * Only the owner of a Team can create a match involving that team. Once a 
 * team owner has created a match, they have control over selecting what 
 * events should be in that match. The events in a match cannot be changed 
 * once the match has started.
 *
 * @author Robin Raqueno
 *
 */
public class MatchesManagePage extends DevcathlonBasePage {
  /** Support serialization. */
  private static final long serialVersionUID = 1L;

  
  /**
   * Creates the Matches Manage page.  
   */
  public MatchesManagePage () {
    // Set the body class attribute to section-3 so that the menubar is correct.
    add(new WebMarkupContainer("body") { 
      private static final long serialVersionUID = 1L;
      @Override
      public boolean isTransparentResolver() { 
        return true; 
        } 
      @Override
      protected void onComponentTag(ComponentTag tag) { 
        tag.put("class","thrColElsHdr section-3"); 
        }
    }
    ); 
    
    try {
        add(new MatchPanel("matchpanel", DevcathlonSession.get().getMatchesSession()
            .getMatchNames()));   
    }
    catch (Exception e) {
      e.printStackTrace();
    }
    
    // Make the tab corresponding to this page bold.
    get("MatchesManageLink").add(new SimpleAttributeModifier("class", "selected"));

  }
}
